import { Controller, Get, Param, ParseIntPipe, UseGuards } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'

import { UserService } from './user.service'

@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @UseGuards(AuthGuard('jwt'))
  @Get('userList')
  public userList() {
    return this.userService.findAllUser()
  }

  @UseGuards(AuthGuard('jwt'))
  @Get('getUser/:id')
  public getUser(@Param('id', new ParseIntPipe()) id: number) {
    return this.userService.findById(id)
  }
}
